# Title     : TODO
# Objective : TODO
# Created by: Administrator
# Created on: 2019/8/12
library(optparse)
library(tidyverse)

option_list <- list(
  make_option("--g", default = "", type = "character", help = "sample group file")
)
opt <- parse_args(OptionParser(option_list = option_list))

sampleInfo <- read_csv(opt$g) %>%
  rename(ClassNote = Group)

svSampleIds <- read_csv("SV.csv") %>%
  .$SampleID

groupTb <- sampleInfo %>%
  rowwise() %>%
  do({
    result <- as_tibble(.)
    classNote <- if (result$SampleID %in% svSampleIds) {
      "Support Vector"
    }else "Other"
    df <- result %>%
      mutate(ClassNote = classNote)
    df
  }) %>%
  ungroup()

groupTb

write_tsv(groupTb, "group.txt")


